<div data-ng-controller="contractDredgeCtrl">
    <div class="table-header clearfix ng-scope">
        <span class="fl lh30 f14">{{contractBaseInfo.contract_code}}</span>
    </div>
    <div class="mt20 clearfix ng-scope ml25">
        <span  class="fl lh30 f14 c-orange">交付信息</span>
        <div class="fr btn-group" ng-if="[2,4,7].indexOf(contractTypeCode)>=0">
            <button type="button" class="btn btn-yellow" ng-click="newPayoverItem()">新增交付</button>
        </div>
    </div>
    <div id="grid" class="table-wrap mt10 ml25" style="min-height: 200px;" ng-if="contractTypeCode == 1">
        <table width="100%">
            <thead>
            <tr>
                <th width="40">序号</th>
                <th>应用名称</th>
                <th width="120">企业名称</th>
                <th width="100">企业代码</th>
                <th width="100" class="align-m">授权数量</th>
                <th width="90">租期(月)</th>
                <th width="100" class="align-m">实际使用数量</th>
                <th width="100">开通时间</th>
                <th width="80">操作</th>
            </tr>
            </thead>
            <tbody>
            <tr ng-repeat="record in payovers">
                <td height="40"><p ng-bind="$index + 1"></p></td>
                <td class="lh14">
                    <p ng-bind="record.application_name"></p>
                </td>
                <td class="lh14">
                    <p ng-if="(record.editMode || 0) == 0" ng-bind="record.tenant_name"></p>

                    <input type="text" name="tenant_name" ng-model="record.tenant_name" class="form-control"
                           ng-if="(record.editMode || 0) != 0"
                           id="inputtext3" placeholder="租户代码">
                </td>
                <td class="lh14">
                    <p ng-if="(record.editMode || 0) == 0" ng-bind="record.tenant_code"></p>

                    <input type="text" name="tenant_code" ng-model="record.tenant_code" class="form-control"
                           ng-if="(record.editMode || 0) != 0"
                           id="inputtext4" placeholder="租户代码">
                </td>
                <td class="align-m">
                    <p ng-bind="record.authorization_numeric"></p>
                </td>
                <td class="lh14">
                  <p ng-if="(record.editMode || 0) == 0" ng-bind="record.authorize_period | number"></p>

                    <input type="number" name="authorize_period" required class="form-control align-r"
                           ng-if="(record.editMode || 0) != 0"
                           ng-model="record.authorize_period"
                           style="width: 100%" placeholder="租期">
                </td>
                <td class="align-m">
                    <a data-ng-click="showAuthorUseInfo(record.auth_id,record.application_id,record.application_name)">{{record.factusernum}}</a>
                </td>
                <td class="lh14">
                    <span ng-bind="record.authorize_time | strdate:'yyyy-MM-dd'"></span>
                </td>
                <td class="lh14">
                    <div ng-if="record.system_flag=='sys_add'">
                        <a ng-if="(record.editMode || 0)  == 0" href="javascript:void(0)"
                           title="修改信息"
                           ng-click="editPayoverSaas(record, $index)">修改</a>
                        <a ng-if="(record.editMode || 0)  != 0" href="javascript:void(0)"
                           title="保存信息"
                           ng-click="savePayoverSaas(record)">确定</a>
                        <a ng-if="(record.editMode || 0)  != 0" href="javascript:void(0)"
                           title="取消"
                           ng-click="cancelPayoverSaas(record, $index)">取消</a>
                    </div>
                </td>
            </tr>
            </tbody>
        </table>
        <div class="no-data" ng-if="!payovers || payovers.length === 0"><span>暂无数据</span></div>
        <div class="ml40" style="line-height:40px" ng-bind-html="payoverremark"></div>
    </div>

    <div class="mt20 clearfix ng-scope ml25"  ng-if="contractTypeCode == 1">
        <span  class="fl lh30 f14 c-orange">交付信息汇总</span>
    </div>
    <div id="grid5" class="table-wrap mt10 ml25" style="min-height: 200px;" ng-if="contractTypeCode == 1">
        <table>
            <thead>
            <tr>
                <th width="50">序号</th>
                <th width="200" >应用名称</th>
                <th width="150" class="align-m">累计开通数量</th>
                <th width="150" class="align-m">合同购买总数</th>
                <th width="150">是否已交付完</th>
            </tr>
            </thead>
            <tbody>
            <tr ng-repeat="record in authorAppList">
                <td height="40"><p ng-bind="$index + 1"></p></td>
                <td class="lh14">
                    <p ng-bind="record.name"></p>
                </td>
                <td class="align-m">
                    <p ng-bind="record.value"></p>
                </td>
                <td class="align-m">
                    <p ng-bind="record.authorization_total"></p>
                </td>
                <td class="lh14">
                    <p ng-bind="record.isover"></p>
                </td>
            </tr>
            </tbody>
        </table>
        <div class="no-data" ng-if="!payovers || payovers.length === 0"><span>暂无数据</span></div>
    </div>

    <div class="mt20 clearfix ng-scope ml25"  ng-if="contractTypeCode == 1">
        <span  class="fl lh30 f14 c-orange">授权使用明细</span>
    </div>
    <div id="grid6" class="table-wrap mt10 ml25" style="min-height: 200px;" ng-if="contractTypeCode == 1">
        <table  width="100%">
            <thead>
            <tr>
                <th width="50">序号</th>
                <th>企业名称</th>
                <th width="150">企业代码</th>
                <th width="150">授权项目名称</th>
                <th width="150">授权开始日期</th>
                <th width="150">授权结束日期</th>
                <th width="150">授权操作时间</th>
            </tr>
            </thead>
            <tbody>
            <tr ng-repeat="record in authAppUseList">
                <td height="40"><p ng-bind="$index + 1"></p></td>
                <td class="lh14">
                    <p ng-bind="record.tenant_name"></p>
                </td>
                <td class="lh14">
                    <p ng-if="(record.editMode || 0) == 0" ng-bind="record.tenant_code"></p>
                </td>
                <td class="lh14">
                    <p ng-if="(record.editMode || 0) == 0" ng-bind="record.project_name"></p>
                </td>
                <td class="align-l">
                    <span ng-bind="record.authorize_begin_time | strdate:'yyyy-MM-dd'"></span>
                </td>
                <td class="align-l">
                    <span ng-bind="record.authorize_end_time | strdate:'yyyy-MM-dd'"></span>
                </td>
                <td class="lh14" class="align-l">
                    <span ng-bind="record.authorize_time"></span>
                </td>
            </tr>
            </tbody>
        </table>
    </div>

    <div id="grid2" class="table-wrap mt10 ml25" style="min-height: 200px;" ng-if="contractTypeCode == 5">
        <table width="100%">
            <thead>
            <tr>
                <th width="40">序号</th>
                <th width="220">应用者</th>
                <th width="200">授权时间</th>
                <th width="150">权益金额</th>
                <th width="150">权益开始日期</th>
                <th width="150">权益结束日期</th>
            </tr>
            </thead>
            <tbody>
            <tr ng-repeat="record in payovers">
                <td height="40"><p ng-bind="$index + 1"></p></td>
                <td class="lh14">
                    <p ng-bind="record.user_name"></p>
                </td>
                <td class="lh14">
                    <p ng-bind="record.authorize_time"></p>
                </td>
                <td class="align-m">
                    <p ng-bind="record.amount"></p>
                </td>
                <td class="lh14">
                    <span ng-bind="record.begin_time | strdate:'yyyy-MM-dd'"></span>
                </td>
                <td class="lh14">
                    <span ng-bind="record.end_time | strdate:'yyyy-MM-dd'"></span>
                </td>
            </tr>
            </tbody>
        </table>
        <div class="no-data" ng-if="!payovers || payovers.length === 0"><span>暂无数据</span></div>
    </div>

    <div id="grid3" class="table-wrap mt10 ml25" style="min-height: 200px;" ng-if="[2,4,7].indexOf(contractTypeCode)>=0">
        <table width="100%">
            <thead>
            <tr>
                <th width="40">序号</th>
                <th width="220">应用名称</th>
                <th width="220">供应商名称</th>
                <th width="150">权益开始日期</th>
                <th width="150">权益结束日期</th>
                <th width="150">操作</th>
            </tr>
            </thead>
            <tbody>
            <tr ng-repeat="record in payovers">
                <td height="40"><p ng-bind="$index + 1"></p></td>
                <td class="lh14">
                    <p ng-if="(record.editMode || 0) == 0" ng-bind="record.application_name"></p>

                    <input type="text" ng-model="record.application_name" class="form-control" id="application_name"
                           ng-if="(record.editMode || 0) != 0" placeholder="应用名称" name="application_name" required data-ng-disabled="true">
                </td>
                <td class="lh14">
                    <p ng-if="(record.editMode || 0) == 0" ng-bind="record.supplier_name"></p>

                    <input type="text" ng-model="record.supplier_name" class="form-control" id="supplier_name"
                           ng-if="(record.editMode || 0) != 0" placeholder="供应商名称" name="supplier_name" required data-ng-disabled="true">
                </td>
                <td class="lh14">
                    <p ng-if="(record.editMode || 0) == 0" ng-bind="record.begin_time|strdate:'yyyy-MM-dd'"></p>

                    <input type="text" name="begin_time" required class="form-control input-date"
                           ng-if="(record.editMode || 0) != 0"
                           ng-model="record.begin_time" ui-date
                           format="yyyy-MM-dd" required
                           style="width: 100%" placeholder="权益开始日期">
                </td>
                <td class="lh14">
                    <p ng-if="(record.editMode || 0) == 0" ng-bind="record.end_time|strdate:'yyyy-MM-dd'"></p>

                    <input type="text" name="end_time" required class="form-control input-date"
                           ng-if="(record.editMode || 0) != 0"
                           ng-model="record.end_time" ui-date
                           format="yyyy-MM-dd" required
                           style="width: 100%" placeholder="权益结束日期">
                </td>
                <td class="lh14">
                    <a ng-if="(record.editMode || 0)  == 0" href="javascript:void(0)"
                       title="修改信息"
                       ng-click="editPayover(record, $index)">修改</a>
                    <a ng-if="(record.editMode || 0)  == 0>1"
                       ng-click="delPayover(record,$index)"
                       href="javascript:void(0)"
                       title="删除信息">删除</a>

                    <a ng-if="(record.editMode || 0)  != 0" href="javascript:void(0)"
                       title="保存信息"
                       ng-click="savePayover(record)">确定</a>
                    <a ng-if="(record.editMode || 0)  != 0" href="javascript:void(0)"
                       title="取消"
                       ng-click="cancelPayover(record, $index)">取消</a>
                </td>
            </tr>
            </tbody>
        </table>
        <div class="no-data" ng-if="!payovers || payovers.length === 0"><span>暂无数据</span></div>
    </div>

    <div id="grid4" class="table-wrap mt10 ml25" style="min-height: 200px;" ng-if="contractTypeCode==3">
        <table width="100%">
            <thead>
            <tr>
                <th width="40">序号</th>
                <th width="220">应用名称</th>
                <th width="150">报告上传时间</th>
            </tr>
            </thead>
            <tbody>
            <tr ng-repeat="record in payovers">
                <td height="40"><p ng-bind="$index + 1"></p></td>
                <td class="lh14">
                    <p ng-bind="record.application_name"></p>
                </td>
                <td class="lh14">
                    <span ng-bind="record.authorize_time | strdate:'yyyy-MM-dd'"></span>
                </td>
            </tr>
            </tbody>
        </table>
        <div class="no-data" ng-if="!payovers || payovers.length === 0"><span>暂无数据</span></div>
    </div>
</div>